<!DOCTYPE html>
<html> 
<head> 
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">  
    <title>密码修改</title> 
    <link rel="shortcut icon" href="favicon.ico">
	<#import "/common/import.ftl" as import>
    <@import.tableManagerImportCss/>
    <link href="${WEB_PATH}/resources/css/plugins/treeview/bootstrap-treeview.css" rel="stylesheet">
    <link href="${WEB_PATH}/resources/css/plugins/jsTree/style.min.css" rel="stylesheet">
</head>

<body class="gray-bg">
	<div class="wrapper wrapper-content animated fadeInRight">
        <!-- Panel Other -->
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h3>登陆密码修改</h3>
                <div class="ibox-tools">
                	
                </div>
            </div>
            <div class="ibox-content">
            	<div class="row row-lg">  
                    <div class="col-sm-12" style="padding-bottom: 200px;">
                        <div class="example-wrap"> 
                            <div class="example"> 
								<form class="m-t" id="editPasswordId">
									<div class="col-sm-3">
				        			</div> 
								    <div class="col-sm-6">
							            <div class="form-group">
							                <label>原始密码：</label>
							                <input id="ypassword" name="ypassword" class="form-control" type="password"> 
							            </div>
							            <div class="form-group"  id="organization_id">
							                <label>新密码</label>
							                <input id="password" name="password" class="form-control" type="password">
							            </div>
							            <div class="form-group"   id="tsorganizationInfo">
							                <label>确认新密码：</label>
							                <input id="confirm_password" name="confirm_password" class="form-control" type="password"> 
							            </div>
						            </div> 
						        </form> 
						        <div class="col-sm-12" style="text-align: center;padding-top: 30px;"> 
						        	<button class="btn btn-primary  " type="button" id="savePassword"><i class="fa fa-check"></i>&nbsp;提交</button>
						        </div>
						      </div>
						  </div>
					</div>
				</div>
            </div>
        </div> 
    </div> 
</body>
<@import.tableManagerImportScript/>
<script>
 $(function(){  
 	var e = "<i class='fa fa-times-circle'></i> "; 
 	$("#editPasswordId").validate({
 		rules:{
 			ypassword: {
                required: !0
            },
 			password: {
                required: !0,
                rangelength: [6, 16]
               
            },
            confirm_password: {
                required: !0,
                rangelength: [6, 16],
                equalTo: "#password"
            },
 		},
 		messages:{
 			ypassword: {
                required: e + "请输入原始密码"
            },
 			 password: {
                required: e + "请输入您的密码",
                minlength: e + "密码必须6个字符以上",
                maxlength: e + "密码必须小于12个字符",
            },
            confirm_password: {
                required: e + "请再次输入密码",
                minlength: e + "密码必须6个字符以上",
                equalTo: e + "两次输入的新密码不一致"
            }
 		}
 	});
 
 	$("#savePassword").click(function(){
    	 if($("#editPasswordId").valid()){
			$.yilinAjax({
		   	  	type:'POST',
		   	  	loadmsg:'努力提交中......',
		   	  	url:'${WEB_PATH }/system/user/editpassword.do',
		   	  	data:$('#editPasswordId').serialize(),
        		errorcallback:null,
        		btn:null,
        		successcallback:success
	   	    });
    	 }
    });
 	
});  
function success(result){  
	if(result.success == true){
		 layer.alert('<font color="#1ab394">'+result.msg+'</font>', {
		  	skin: 'layui-layer-molv',
		  	icon: 1,
		  	closeBtn: 0
		},function(){
            location.href = "${WEB_PATH }/system/user/logout.do";			
		});
	}else{ 
    	layer.msg(result.msg, {icon: 5}); 
	} 
}

 

	 
  </script>   
</html>